﻿
/***
** 作者:冯瑞
** 日期:2017-08-19
** 功能:桥西区预约查询
**/
//页面调用主函数

var arrlc = new Array();
var bjgc = new Array();
var slbh = "";
function ShowMain() {
    slbh = request("slbh");
    GetNewList();
}

function GetNewList() {
    //debugger;

    var url = encodeURI(SWebPath + '/weixin/action/detail_jszgrd.aspx?slbh=' + slbh);
    var pars = encodeURI('');
    var myAjax = new Ajax.Request(url, { method: 'get', parameters: pars, onComplete: sGetNewList, onFailure: fGetNewList });
}

function sGetNewList(o) {
    arrlc = Map_YInfo(o, "Web_Yy");
    if (arrlc.length > 0) {
        ShowContent();
    }
    else {
        alert("没有查到预约记录");
        setTimeout("goBack()", 1000);
    }
}

function fGetNewList(o) { }


function ShowContent() {
    //debugger;

    var str = "";
    str += '<div class="sxdetail">';
    for (var i = 0; i < arrlc.length; i++) {
        if (arrlc.length == 1)
            str += '  <div class="sxtitle_selected" id="click_' + (i + 1) + '">预约信息</div>';
        else
            str += '  <div class="sxtitle_selected" id="click_'+(i+1)+'">预约信息'+(i+1)+'</div>';
    str += '  <div class="detail" id="menu_' + (i + 1) + '">';
    str += '    <dl>';
    str += '      <dt>预约时间</dt>';
    str += '      <dd id="slbh">'+arrlc[i].seldate+'（'+arrlc[i].sjduan+'）</dd>';
    str += '    </dl>';
    if (arrlc[i].type != "3" && arrlc[i].type != "4") {
        str += '    <dl>';
        str += '      <dt>企业名称</dt>';
        str += '      <dd id="xmmc">' + arrlc[i].xm + '</dd>';
        str += '    </dl>';
    }
    else {
        str += '    <dl>';
        str += '      <dt>申  请  人</dt>';
        str += '      <dd id="xmmc">' + arrlc[i].xm + '</dd>';
        str += '    </dl>';
    }
    str += '    <dl>';
    str += '      <dt>身份证号</dt>';
    str += '      <dd id="slbm">'+arrlc[i].sfz+'</dd>';
    str += '    </dl>';
    str += '    <dl>';
    str += '      <dt>手机号码</dt>';
    str += '      <dd id="sqsj">'+arrlc[i].tel+'</dd>';
    str += '    </dl>';
    str += '    <dl style="border-bottom:none;">';
    str += '      <dt>业务类型</dt>';
    if (arrlc[i].type == "1") {
        str += '      <dd id="blzt">企业设立</dd>';
    }
    else if (arrlc[i].type == "2") {
        str += '      <dd id="blzt">企业变更</dd>';
    }
    else if (arrlc[i].type == "3") {
        str += '      <dd id="blzt">个体工商户设立</dd>';
    }
    else {
        str += '      <dd id="blzt">教师资格认定</dd>';
    }
    str += '    </dl>';
	if (arrlc[i].type == "3")
    {
        str += '    <dl>';
        str += '      <dt>办理地点</dt>';
        str += '      <dd id="sqsj">' + arrlc[i].bldd + '</dd>';
        str += '    </dl>';
    }
    str += '  </div>';
    if (arrlc[i].sfqx == "1") {
        str += '<a onclick="canle(\'' + arrlc[i].id + '\')"><div class="button" align="center">取 消 预 约</div></a>';
    }
    str += '<div style="height:20px;"></div>';

    }
    str += ' </div>';
    str += '</div>';
    

    $("StrContent").innerHTML = str;
}

function goBack()
{
    history.go(-1);
}

function canle(id)
{
     if (confirm("您确认取消本次预约吗？")) {
        var url = encodeURI(SWebPath + '/weixin/action/delyy_jszgrd.aspx?id=' + id);
        var pars = encodeURI('');
        var myAjax = new Ajax.Request(url, { method: 'get', parameters: pars, onComplete: sDelyy, onFailure: fDelyy });
    }
}

function sDelyy(o)
{
    var root = o.responseXML.documentElement;
    var OutputFlag = GetXmlData(root, "Value");
    if (OutputFlag == "true") {
        alert("取消成功");
        setTimeout("goBack()", 1000);
    }
}

function fDelyy(o) { }
